<?php namespace Home\Model;

use Framework\Model\Model;

class Ask extends Model{

	//调入问题表
	public $table = 'question';

	//操作问题表
	public function ask_exec()
	{
		// p($_POST);exit;
		$sql = "INSERT INTO question (create_at,content,cat_id,user_id) values(?,?,?,?)";
		$data = [

			'create_at'=>time(),
			'content'=>$_POST['content'],
			'cat_id'=>$_POST['cat_id'],
			'user_id'=>$_SESSION['id']
		];
		if($this->execute($sql,$data))
		{
			// echo "where is id";
			return $this->getInsertId();
		}
		else
		{
			$this->error ='添加失败';
			return false;
		}
	}


}